﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using Microhard.WeixinMP.Interfaces;
using Microhard.Core;
using Microhard.WeixinMP.Models;
using System.IO;

namespace Microhard.WeixinMP.Impls
{
    public class WeixinImageController : Controller
    {
        public virtual ActionResult ImageList(Guid ConversationID)
        {
            IImage image = IoC.Resolve<IImage>();
            List<ImageModel> rtn = image.Query(new Models.ImageModel { ConversationID = ConversationID });
            return View(rtn);
        }

        public virtual ActionResult SingleImage(Guid imageID)
        {
            IImage image = IoC.Resolve<IImage>();
            var im = image.GetModelByID(imageID);
            byte[] bys = im.ImageContent;
            return File(bys, "image/jpeg");
        }
    }
}
